package com.sgb.kjwl.view.ui.activity.transport;

import android.content.Context;
import android.content.Intent;
import androidx.databinding.DataBindingUtil;
import android.util.Log;
import android.view.View;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityGoodsInfoPublicSource3Binding;
import com.sgb.kjwl.model.entity.transport.PublicSourceEntity3;
import com.sgb.kjwl.view.widget.GoodsInfoPublicSelectPopWindow3;
import com.swgk.core.dialog.BasePopWindow;

import java.util.ArrayList;
import java.util.List;

public class GoodsInfoPublicSourceActivity3 extends AppActivity {

    private ActivityGoodsInfoPublicSource3Binding binding;
    private GoodsInfoPublicSelectPopWindow3 pop;

    public static void start(Context context){
        Intent intent = new Intent(context, GoodsInfoPublicSourceActivity3.class);
        context.startActivity(intent);
    }

    @Override
    protected void initView() {
        binding = DataBindingUtil.setContentView(this, R.layout.activity_goods_info_public_source3);

        binding.include.ivBack.setOnClickListener(this);
        binding.include.titleView.setText("发布货源");
        binding.selectCarType.setOnClickListener(this);
        binding.selectCarLength.setOnClickListener(this);

//        GoodsInfoPublicSourceAdapter3 adapter = new GoodsInfoPublicSourceAdapter3(this,null);

        pop = new GoodsInfoPublicSelectPopWindow3(this);
        pop.setBgView(binding.grayLayout);

    }

    @Override
    protected void init() {

    }

    @Override
    public void onClick(View v) {
        super.onClick(v);

        switch (v.getId()){
            case R.id.iv_back:
                finish();
                break;
            case R.id.select_car_type:
                List<PublicSourceEntity3> mOptionsItems = new ArrayList<>();
                mOptionsItems.add(new PublicSourceEntity3("平板",1));
                mOptionsItems.add(new PublicSourceEntity3("箱式",2));
                mOptionsItems.add(new PublicSourceEntity3("高栏",3));
                mOptionsItems.add(new PublicSourceEntity3("冷藏",4));
                mOptionsItems.add(new PublicSourceEntity3("冷冻",5));
                pop.setData("选择车型",mOptionsItems);
                pop.setOnResultCallBack(new BasePopWindow.OnResultCallBack() {
                    @Override
                    public void result(Object result) {
                        Log.v("select",((PublicSourceEntity3)result).getName());
                    }
                });
                pop.showDownPopwindow(binding.grayLayout, true);
                break;
            case R.id.select_car_length:
                List<PublicSourceEntity3> mOptionsItems1 = new ArrayList<>();
                mOptionsItems1.add(new PublicSourceEntity3("10米",1));
                mOptionsItems1.add(new PublicSourceEntity3("11米",2));
                mOptionsItems1.add(new PublicSourceEntity3("12米",3));
                mOptionsItems1.add(new PublicSourceEntity3("13米",4));
                mOptionsItems1.add(new PublicSourceEntity3("13米",5));
                pop.setData("选择车长",mOptionsItems1);
                pop.setOnResultCallBack(new BasePopWindow.OnResultCallBack() {
                    @Override
                    public void result(Object result) {
                        Log.v("select",((PublicSourceEntity3)result).getName());
                    }
                });
                pop.showDownPopwindow(binding.grayLayout, true);
                break;
        }
    }


}
